package com.vuespringboot.demo.repository;

import com.vuespringboot.demo.entity.Instrument;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author Lu
 * @date 2021/1/1 - 13:19
 */
@Component
public interface InstrumentRepository extends JpaRepository<Instrument, Integer> {

	//根据名称模糊查询
	@Query (value = "select t from Instrument t where t.inName like %?1% ")
	List<Instrument> findByNameLike(String inName);

	//根据仪器名称模糊分页查询
	Page<Instrument> findByinNameContainingOrderByInIdDesc(String name,Pageable pageable);

}
